type IType =
  | 'Null'
  | 'Undefined'
  | 'Number'
  | 'Boolean'
  | 'String'
  | 'Array'
  | 'Function'
  | 'Object'
  | 'Math'
  | 'Date'
  | 'RegExp'
  | 'Symbol';

/**
 * 类型判断
 * @param {String} type 值的类型
 * @param {Any} val 需要判断的值
 * @return {Boolean}
 */
export const checkType = (type: IType, val: any) => {
  type = (type.substring(0, 1).toUpperCase() + type.substring(1)) as IType;

  return Object.prototype.toString.call(val) === `[object ${type}]`;
};

export const isEmptyObject = (obj: any) => {
  return Object.getOwnPropertyNames(obj).length === 0;
};
